package xcmg.device.dao.mapper.threeGuaranteesPur;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import xcmg.device.dao.entity.threeGuaranteesPur.ThreeGuaranteesOutDetailDO;
import xcmg.device.service.vo.boxup.BoxupDetailVO;
import xcmg.device.service.vo.boxup.BoxupMaterialsQuery;
import xcmg.device.service.vo.delivery.BillDetailMaterialsVO;
import xcmg.device.service.vo.delivery.BoxUpDeliveryNoteVO;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Mapper
public interface ThreeGuaranteesOutDetailMapper {
    int delete(String id);

    int add(ThreeGuaranteesOutDetailDO record);

    int update(ThreeGuaranteesOutDetailDO record);

    List<ThreeGuaranteesOutDetailDO> list(@Param("guaranteesOutNo") String guaranteesOutNo);

    List<ThreeGuaranteesOutDetailDO> listForLocationUser(@Param("guaranteesOutNo") String guaranteesOutNo);

    ThreeGuaranteesOutDetailDO findByNo(@Param("guaranteesOutNo") String guaranteesOutNo, @Param("materialsNo") String materialsNo);

    int deleteBy(@Param("guaranteesOutNo") String guaranteesOutNo);

    int updateOutQty (@Param("orgId")String orgId, @Param("outQty")BigDecimal outQty, @Param("purchaseNo") String purchaseNo, @Param("materialsNo") String materialsNo);

    int removeByOutIds(@Param("outIds") List<String> outIds);

    int updateStatus(@Param("status") int status, @Param("billNo") String deliveryNo,@Param("materialsNo") String materialsNo);

    int findNumByState(@Param("purchaseNo") String purchaseNo,@Param("billNo") String billNo,@Param("materialsNo") String materialsNo,@Param("orgId")String orgId);

    BoxUpDeliveryNoteVO itemByNoAndMaterialsNo(@Param("orgId")String orgId, @Param("deliveryNoteNo")String deliveryNoteNo, @Param("materialsNo") String materialsNo);

    List<BoxupDetailVO> notPackList(BoxupMaterialsQuery boxupMaterialsQuery);
    List<BillDetailMaterialsVO> moreBillDetail(@Param("deliveryBillId")String deliveryBillId);

    void updateArrivalTimeAndRemark(@Param("outDetailId") String outDetailId , @Param("purExpectArrivalTime") Date arrivalTime, @Param("remark") String remark);

    void updateArrivalTime(@Param("outDetailId") String outDetailId , @Param("purExpectArrivalTime") Date arrivalTime);


    int updatePostAmount(@Param("billId") String billId, @Param("materialNo")String materialNo, @Param("voucherNo")String voucherNo);

    int findPostStatus(@Param("billNo")String billNo);

    int updatePostStatus(@Param("billId")String billId, @Param("postStatus")int postStatus);

    int updateVoucherNoNone(@Param("billId")String billId, @Param("materialsNo")String materialsNo);

    /**
     * 查询已三包申请零件已创建三包出库单的数量
     *
     * @param purchaseNo
     * @param materialsNo
     * @return
     */
    BigDecimal countHasDeliveryQty(@Param("purchaseNo") String purchaseNo, @Param("materialsNo") String materialsNo);

    /**
     * 根据id查询记录*/
    ThreeGuaranteesOutDetailDO selectById(String id);

    List<ThreeGuaranteesOutDetailDO> getMaterialInfoByNo(List<String> guaranteesNoList);

    int updateReturnStatus(@Param("guaranteesOutNo") String guaranteesOutNo,@Param("materialsNo") String materialsNo,@Param("returnStatus") Integer returnStatus,@Param("receiveDate") Date receiveDate);

    int updateWornreturnRemark(@Param("guaranteesOutNo") String guaranteesOutNo,@Param("materialsNo") String materialsNo,@Param("waornreturnRemak") String waornreturnRemak);
}
